package work.dp;

/**
 * @author WDH
 * @description
 * @date 2024年12月03日 23:11
 */

public class Problem96 {

    public int numTrees(int n) {
        int[] dp = new int[n + 1];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j < i + 1; j++) {
                int temp =  dp[j-1] * dp[i-j];
                dp[i] = dp[i] + temp;
            }
        }
return dp[n];

}}
